home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kgame / kgamedebugdialog.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  4.0 KB  |  150 lines

  1. /*
  2.     This file is part of the KDE games library
  3.     Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
  4.     Copyright (C) 2001 Martin Heni (martin@heni-online.de)
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License version 2 as published by the Free Software Foundation.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.     Boston, MA 02110-1301, USA.
  19. */
  20.  
  21. #ifndef __KGAMEDEBUGDIALOG_H__
  22. #define __KGAMEDEBUGDIALOG_H__
  23.  
  24. #include <kdialogbase.h>
  25. #include <kdemacros.h>
  26.  
  27. class KGame;
  28. class KGameIO;
  29. class KPlayer;
  30. class KGamePropertyBase;
  31.  
  32. class KGameDebugDialogPrivate;
  33.  
  34. class KDE_EXPORT KGameDebugDialog : public KDialogBase
  35. {
  36.     Q_OBJECT
  37. public:
  38.     KGameDebugDialog(KGame* g, QWidget* parent, bool modal = false);
  39.     ~KGameDebugDialog();
  40.  
  41.     /**
  42.      * Automatically connects the KGame object to all error dependant slots. 
  43.      * Create a KGameErrorDialog object, call this function and forget
  44.      * everything.
  45.      * @param g The KGame which will emit the erorrs (or not ;-) )
  46.      **/
  47.     void setKGame(const KGame* g);
  48.  
  49. public slots:
  50.     /**
  51.      * Unsets a @ref KGame which has been set using @ref setKGame before.
  52.      * This is called automatically when the @ref KGame object is destroyed
  53.      * and you normally don't have to call this yourself.
  54.      *
  55.      * Note that @ref setKGame also unsets an already existing @ref KGame
  56.      * object if exising.
  57.      **/
  58.     void slotUnsetKGame();
  59.  
  60.     /**
  61.      * Update the data of the @ref KGame object
  62.      **/
  63.     void slotUpdateGameData();
  64.  
  65.     /**
  66.      * Update the properties of the currently selected player
  67.      **/
  68.     void slotUpdatePlayerData();
  69.  
  70.     /**
  71.      * Updates the list of players and calls @ref clearPlayerData. Note that
  72.      * after this call NO player is selected anymore.
  73.      **/
  74.     void slotUpdatePlayerList();
  75.  
  76.     void slotClearMessages();
  77.  
  78. signals:
  79.     /**
  80.      * This signal is emitted when the "debug messages" page couldn't find
  81.      * the name of a message id. This is usually the case for user-defined
  82.      * messages. KGameDebugDialog asks you to give the msgid a name.
  83.      * @param messageid The ID of the message. As given to @ref
  84.      * KGame::sendMessage
  85.      * @param userid User defined msgIds are internally increased by
  86.      * @ref KGameMessage::IdUser. You don't have to care about this but if
  87.      * this signal is emitted with userid=false (shouldn't happen) then the
  88.      * name of an internal message as defined in @ref
  89.      * KGameMessage::GameMessageIds couldn't be found.
  90.      * @param name The name of the msgid. You have to fill this!
  91.      **/
  92.     void signalRequestIdName(int messageid, bool userid, QString& name);
  93.  
  94. protected:
  95.     void clearPages();
  96.  
  97.     /**
  98.      * Clear the data of the player view. Note that the player list is NOT
  99.      * cleared.
  100.      **/
  101.     void clearPlayerData();
  102.  
  103.     /**
  104.      * Clear the data view of the @ref KGame object
  105.      **/
  106.     void clearGameData();
  107.  
  108.     /**
  109.      * Add a new player to the player list
  110.      **/
  111.     void addPlayer(KPlayer* p);
  112.  
  113.     /**
  114.      * Remove a player from the list
  115.      **/
  116.     void removePlayer(QListBoxItem* item);
  117.  
  118.     /**
  119.      * @return Whether messages with this msgid shall be displayed or not
  120.      **/
  121.     bool showId(int msgid);
  122.  
  123. protected slots:
  124.     /**
  125.      * Update the data of the player specified in item
  126.      * @param item The @ref QListBoxItem of the player to be updated. Note
  127.      * that the text of this item MUST be the ID of the player
  128.      **/
  129.     void slotUpdatePlayerData(QListBoxItem* item);
  130.  
  131.     void slotShowId();
  132.     void slotHideId();
  133.  
  134.     /**
  135.      * A message has been received - see @ref KGame::signalMessageUpdate
  136.      **/
  137.     void slotMessageUpdate(int msgid, Q_UINT32 receiver, Q_UINT32 sender);
  138.  
  139. private:
  140.     void initGamePage();
  141.     void initPlayerPage();
  142.     void initMessagePage();
  143.  
  144. private:
  145.     KGameDebugDialogPrivate* d;
  146. };
  147.  
  148.  
  149. #endif
  150.